// Computer Grade.cpp -- This program computes a student's grade
// CSCI 111-03
// Source -- Open Source

#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstdlib>
#include <fstream>
using namespace std;

int main() {
	// write out your name and lab number to the terminal IAW Lab submittal instructions
	cout << "Dylan Brucki -- Lab 4" << endl << endl;

	// define variables
	float grade;
	int roundgrade;
	float score;
	float total;
	ifstream inFile;
	
	// bring in score and total and find grade
	inFile.open("grades.txt");
	inFile >> score >> total;
	grade = score / total;
	grade = grade * 100;

	// round up the grade
	roundgrade = ceil(grade);

	// show grade
	cout << "Your grade is " << fixed << setprecision(5) << grade << endl << "Your rounded grade is " << roundgrade << "%" << endl;

	// if else statement on the grades
	if (grade > 90)
	{
		cout << "Excellent!" << endl;
	}
	else if (grade > 80)
	{
		cout << "Well Done!" << endl;
	}
	else if (grade > 70)
	{
		cout << "Good" << endl;
	}
	else if (grade >= 60)
	{
		cout << "Need Improvement" << endl;
	}
	else if (grade < 60)
	{
		cout << "FAIL" << endl;
	}

	inFile.close();

	// pause command window and then return 0
	system("pause");
	return 0; 
}